#pragma once
#include <set>
#include <vector>
#include <utility>
#include <map>
#include <cassert>

#include <cstdio>

struct ptr_list
{
	void *ptr;
	int cnt;

	ptr_list ()
	{
		next = 0;
		ptr = 0;
		cnt = 0;
	}

	ptr_list (void *v, int i)
	{
		next = 0;
		ptr = v;
		cnt = i;
	}


	ptr_list *next;
};

void add (ptr_list *&head, void *ptr, int cnt);
void clear (ptr_list *v);
void dec (void *p);
void inc (void *p);
ptr_list* collect ();

